package com.example.stretching;

import com.example.db.DLog;
import com.example.db.DbopenHelper;
/**
 * DB에서 받아온 값을 ArrayList에 Add
 * db insert, delete, update 하는 클래스가 다 달라서
 * 템플릿 으로 사용해서 뿌려줌 
 * @author DS
 */
public class doWhileCursorToArray {
	protected static AlarmData mAlarmData;

	private static final String TAG = "TestDataBaseActivity";
	
	public static void doWhileCursorToArray() {
		MainActivity.arrayListAlarmTimeItem.size();

		MainActivity.mCursor = null;
		MainActivity.mCursor = DbopenHelper.getAllColumns();
		DLog.e(TAG, "COUNT = " + MainActivity.mCursor.getCount());

		while (MainActivity.mCursor.moveToNext()) {

			mAlarmData = new AlarmData(MainActivity.mCursor.getInt(MainActivity.mCursor
					.getColumnIndex("_id")), MainActivity.mCursor.getString(MainActivity.mCursor
					.getColumnIndex("mon")), MainActivity.mCursor.getString(MainActivity.mCursor
					.getColumnIndex("tue")), MainActivity.mCursor.getString(MainActivity.mCursor
					.getColumnIndex("wed")), MainActivity.mCursor.getString(MainActivity.mCursor
					.getColumnIndex("thu")), MainActivity.mCursor.getString(MainActivity.mCursor
					.getColumnIndex("fri")), MainActivity.mCursor.getString(MainActivity.mCursor
					.getColumnIndex("sat")), MainActivity.mCursor.getString(MainActivity.mCursor
					.getColumnIndex("sun")), MainActivity.mCursor.getInt(MainActivity.mCursor
					.getColumnIndex("fromtimehour")), MainActivity.mCursor.getInt(MainActivity.mCursor
					.getColumnIndex("fromtimeminute")), MainActivity.mCursor.getInt(MainActivity.mCursor
					.getColumnIndex("totimehour")), MainActivity.mCursor.getInt(MainActivity.mCursor
					.getColumnIndex("totimeminute")),
					MainActivity.mCursor.getString(MainActivity.mCursor.getColumnIndex("onoff")));

			MainActivity.arrayListAlarmTimeItem.add(mAlarmData);
		}

		MainActivity.mCursor.close();
	}
}